= form_errors(@service)

- if @service.help.present?
  .well
    = preserve do
      = markdown @service.help

.form-group
  = form.label :active, "激活", class: "control-label"
  .col-sm-10
    = form.check_box :active

- if @service.supported_events.length > 1
  .form-group
    = form.label :url, "触发", class: 'control-label'
    .col-sm-10
      - if @service.supported_events.include?("push")
        %div
          = form.check_box :push_events, class: 'pull-left'
          .prepend-left-20
            = form.label :push_events, class: 'list-label' do
              %strong 推送事件
            %p.light
              推送仓库时将触发此链接
      - if @service.supported_events.include?("tag_push")
        %div
          = form.check_box :tag_push_events, class: 'pull-left'
          .prepend-left-20
            = form.label :tag_push_events, class: 'list-label' do
              %strong 标签推送事件
            %p.light
              新标签推送仓库时将触发此链接
      - if @service.supported_events.include?("note")
        %div
          = form.check_box :note_events, class: 'pull-left'
          .prepend-left-20
            = form.label :note_events, class: 'list-label' do
              %strong 评论
            %p.light
              有人增加评论时将触发此链接
      - if @service.supported_events.include?("issue")
        %div
          = form.check_box :issues_events, class: 'pull-left'
          .prepend-left-20
            = form.label :issues_events, class: 'list-label' do
              %strong 问题事件
            %p.light
              问题创建、更新、合并时将触发此链接
      - if @service.supported_events.include?("merge_request")
        %div
          = form.check_box :merge_requests_events, class: 'pull-left'
          .prepend-left-20
            = form.label :merge_requests_events, class: 'list-label' do
              %strong 合并请求事件
            %p.light
              合并请求创建、更新、合并时将触发此链接
      - if @service.supported_events.include?("build")
        %div
          = form.check_box :build_events, class: 'pull-left'
          .prepend-left-20
            = form.label :build_events, class: 'list-label' do
              %strong 构建事件
            %p.light
              构建状态改变时将触发此链接
      - if @service.supported_events.include?("wiki_page")
        %div
          = form.check_box :wiki_page_events, class: 'pull-left'
          .prepend-left-20
            = form.label :wiki_page_events, class: 'list-label' do
              %strong 维基页面事件
            %p.light
              维基页面创建、更新时将触发此链接


- @service.fields.each do |field|
  - type = field[:type]

  - if type == 'fieldset'
    - fields = field[:fields]
    - legend = field[:legend]

    %fieldset
      %legend= legend
      - fields.each do |subfield|
        = render 'shared/field', form: form, field: subfield
  - else
    = render 'shared/field', form: form, field: field
